package edu.zju.gis.dbfg.model.statistic;

import lombok.Getter;
import lombok.Setter;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.Serializable;

@Getter
@Setter
public class ChangeStatisticArgs implements Serializable {

    private final static Logger logger = LoggerFactory.getLogger(AreaStatisticArgs.class);

    @Option(name = "-output",usage = "输出文件路径", required = true)
    private String output;

    @Option(name = "-input1",usage = "输入数据", required = true)
    private String input1;

    @Option(name = "-type1",usage = "输入数据类型", required = true)
    private String type1;

    @Option(name = "-ccIndex1",usage = "前年份CC码字段", required = true)
    private String ccIndex1;

    @Option(name = "-ccIndex2",usage = "后年份CC码字段", required = true)
    private String ccIndex2;

    @Option(name = "-pacIndex1",usage = "行政区划代码", required = true)
    private String pacIndex1;

    @Option(name = "-areaIndex1",usage = "面积字段", required = true)
    private String areaIndex1;

//    @Option(name = "-input2",usage = "输入数据t,lyear", required = true)
//    private String input2;
//
//    @Option(name = "-type2",usage = "输入数据类型,lyear", required = true)
//    private String type2;
//
//    @Option(name = "-ccIndex2",usage = "输入数据类型,extent", required = true)
//    private String ccIndex2;
//
//    @Option(name = "-pacIndex2",usage = "输入数据类型,extent", required = true)
//    private String pacIndex2;
//
//    @Option(name = "-areaIndex2",usage = "输入数据类型,extent", required = true)
//    private String areaIndex2;

    @Option(name = "-input3",usage = "输入数据,extent", required = true)
    private String input3;

    @Option(name = "-type3",usage = "输入数据类型,extent", required = true)
    private String type3;

    @Option(name = "-id3Index",usage = "输入数据id,extent", required = true)
    private String id3Index;

    @Option(name = "-crs1",usage = "extent crs")
    private String crs1 = "4326";

//    @Option(name = "-crs2",usage = "target crs")
//    private String crs2 = "GEOGCS[\"GCS_WGS_1984\", \n" +
//            "  DATUM[\"D_WGS_1984\", \n" +
//            "    SPHEROID[\"WGS_1984\", 6378137.0, 298.257223563]], \n" +
//            "  PRIMEM[\"Greenwich\", 0.0], \n" +
//            "  UNIT[\"degree\", 0.017453292519943295], \n" +
//            "  AXIS[\"Longitude\", EAST], \n" +
//            "  AXIS[\"Latitude\", NORTH]]";

    @Option(name = "-crs3",usage = "target crs")
    private String crs3 = "4326";

    @Option(name = "-parallelize", usage="parallelize num")
    private int partitionNum = 4;

    public  static ChangeStatisticArgs initArgs(String args[]){
        ChangeStatisticArgs mArgs = new ChangeStatisticArgs();
        CmdLineParser parser = new CmdLineParser(mArgs);
        try {
            parser.parseArgument(args);
            return mArgs;
        } catch (CmdLineException e) {
            logger.error(e.getLocalizedMessage());
            return null;
        }
    }

}
